import request from '@/utils/request'

// 获取权益分页
export function getPageEquity(query) {
  return request({
    url: '/equity/equities',
    method: 'get',
    params: query
  })
}

// 添加权益
export function saveEquity(data) {
  return request({
    url: '/equity/saveEquity',
    method: 'post',
    data
  })
}

// 更新权益
export function updateEquity(entity) {
  return request({
    url: '/equity/equities',
    method: 'put',
    data: entity
  })
}

// 获取已存权益
export function getEquityByID(id) {
  return request({
    url: '/equity/equities/' + id,
    method: 'get'
  })
}

// // 修改权益
// export function updateEquity(data) {
//   return request({
//     url: '/equity/updateEquity',
//     method: 'post',
//     data
//   })
// }

// 获取权益等级
export function getEquityLevel(query) {
  return request({
    url: '/equity/getEquityLevel',
    method: 'post',
    params: query
  })
}

// 删除权益
export function deleteEquity(data) {
  return request({
    url: '/equity/deleteEquity',
    method: 'post',
    data
  })
}

export function deleteEquityByID(equityID) {
  return request({
    url: `/equity/equities/${equityID}`,
    method: 'delete'
  })
}

// 删除等级
export function deleteEquityLevel(data) {
  return request({
    url: '/equity/deleteEquityLevel',
    method: 'post',
    data
  })
}

// 更新等级
export function updateEquityLevel(data) {
  return request({
    url: '/equity/updateEquityLevel',
    method: 'post',
    data
  })
}

// 添加等级
export function saveEquityLevel(data) {
  return request({
    url: '/equity/saveEquityLevel',
    method: 'post',
    data
  })
}

// 勾掉服务等级
export function deleteLevelService(data) {
  return request({
    url: '/equity/deleteLevelService',
    method: 'post',
    data
  })
}

// 勾选服务等级
export function saveLevelService(data) {
  return request({
    url: '/equity/saveLevelService',
    method: 'post',
    data
  })
}
